<template>
    <el-switch
        v-model="formData[item.prop]"
        :width="item.width"
        :active-color="item.activeColor"
        :inactive-color="item.inactiveColor"
        :active-value="item.activeValue"
        :inactive-value="item.inactiveValue"
        :active-text="item.activeText"
        :inactive-text="item.inactiveText"
        :disabled="disabled || item.disabled"
        :readonly="readonly || item.readonly"
        :style="item.style"
        @change="change"
    />
</template>

<script>
import { useFormProps, changeItem } from './useFormProps'
import { defineComponent } from 'vue'
export default defineComponent({
    name: 'useSwitch',
    props: useFormProps,
    emits: ['event'],
    setup(props, context) {
        const change = () => {
            changeItem(context, props)
        }
        return {
            change
        }
    }
})
</script>

<style lang="scss" scoped></style>
